package com.alstudio.net.protocol.xmpp.parser.iq;

import java.io.IOException;
import java.util.ArrayList;

import org.xmlpull.v1.XmlPullParserException;

import com.alstudio.net.protocol.xmpp.XmppListener;
import com.alstudio.net.protocol.xmpp.packact.IQ;
import com.alstudio.net.protocol.xmpp.parser.iq.IQParseEventHandler.IQXmlParseEventCallback;
import com.alstudio.utils.log.Mylog;

public class FeedBackIQPackactParser extends BaseIQParser implements
		IQXmlParseEventCallback {


	@Override
	public void parseIQPackage(IQ packact, String stream,
			XmppListener listener) throws Exception {
		// TODO Auto-generated method stub
		mListener = listener;
		startParse(packact, stream, this);

	}

	@Override
	public void processErrorStartTag(String tag) {
		// TODO Auto-generated method stub
		Mylog.e("出现错误");
	}

	@Override
	public void processSetStartTag(String tag) {
		// TODO Auto-generated method stub

	}

	@Override
	public void processGetStartTag(String tag) {
		// TODO Auto-generated method stub

	}

	@Override
	public void processResultStartTag(String tag) {
		// TODO Auto-generated method stub
//		Mylog.e("得到结果 tag: " + tag);
		ArrayList<String> atts = new ArrayList<String>();
		try {
			atts = getAttributes(tag);
		} catch (XmlPullParserException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		for (String s : atts) {
			Mylog.e("属性有: " + s + " value为: " + getAttValue(s));
		}
	}

	@Override
	public void processEndTag(String tag) {
		// TODO Auto-generated method stub

	}

	@Override
	public void processStartDocument() {
		// TODO Auto-generated method stub

	}

	@Override
	public void processEndDocument() {
		// TODO Auto-generated method stub
		onCallback();
	}

	@Override
	public void onCallback() {
		// TODO Auto-generated method stub
		
	}

}
